/**
 * 
 */
package info.niwota.start.app;

import info.niwota.start.Debug;
import info.niwota.start.Notifications;
import info.niwota.start.Preferences;
import info.niwota.start.ScreenService;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;

/**
 * @author qiangli
 *
 */
public class AppSelectActivity extends ChoiceListActivity {

	private static final String TAG = "AppSelectActivity";
	
	private static final Object KEY_POWERUP = "powerup";
	
	private static final Object KEY_STATUSBAR = "statusbar";

	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}


	@Override
	protected void showOrHideActions(boolean b) {
		//always show
		showActions();
	}

	@Override
	public void finish() {
		super.finish();
		
		if (Debug.DEBUG) {
			Log.d(TAG, "finish key: " + key);
		}
		final Context ctx = this;
		if (KEY_POWERUP.equals(key)) {
			if (Preferences.enablePowerFeature(ctx)) {
				ScreenService.startup(this);
			} else {
				ScreenService.shutdown(ctx);
			}
		} else if (KEY_STATUSBAR.equals(key)) {
			Notifications.update(ctx);
		}
	}

}
